package internal

import (
	"base"
	"game_server/chanrpc"
	"game_server/internal"
	"game_server/logic"
	"leaf/gate"
)

type Module struct {
	*gate.MultiClient
}

func (module *Module) OnPrepare() {
	multiClient := new(gate.MultiClient)
	multiClient.PendingWriteNum = internal.PendingWriteNum
	multiClient.MaxMsgLen = internal.MaxMsgLen
	multiClient.Processor = base.Processor
	multiClient.LenMsgLen = internal.LenMsgLen
	multiClient.LittleEndian = base.LittleEndian
	multiClient.ChanRPCServer = ChanRpc
	multiClient.ConnectServer = chanrpc.ConnectGateServer
	multiClient.CloseServer = chanrpc.CloseGateServer
	multiClient.NewAgent = chanrpc.NewGateAgent
	multiClient.CloseAgent = chanrpc.CloseGateAgent

	module.MultiClient = multiClient
}

func (module *Module) OnInit() {
	module.MultiClient.OnInit()

	module.MultiClient.AgentChanRPC = logic.ChanRpc
}
